<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
用户名：<input type="text" id="username" name="username"/>
密码：<input type="password" id="password" name="password"/>
<button type="submit" onclick="login()">提交</button>
<script>
    function login() {
        const username = document.getElementById('username').value
        const password = document.getElementById('password').value
        fetch('/login',{
            method:'POST',
            body:JSON.stringify({username,password}),
            headers:{
                "Content-Type":"application/json;charset=utf-8"
            }
        }).then(res=>{
            const data = res.json()
            console.log(data)
        })
    }
</script>
</body>
</html>
